<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCollectionApiRequestsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('collection_api_requests', function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->comment = '催收被调接口记录表';
            $table->increments('id');
            $table->timestamp('request_time')->nullable()->comment('请求时间');
            $table->timestamp('receipt_time')->nullable()->comment('回执对方接口的时间');
            $table->unsignedTinyInteger('api_type')->comment('减免,代扣,销账,全部结清');
            $table->text('request_data')->comment('催收请求过来的数据');
            $table->text('response_data')->comment('响应数据');
            $table->string('apply_number',126)->index()->default('')->comment('催收那边的流水号');
            $table->unsignedTinyInteger('status')->default(0)->comment('1 => 响应成功 2 => 回执成功');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('collection_api_requests');
    }
}
